/**
 * Created by dashan on 2017/3/19.
 */

const util = require('util');



// function list() {
//     for (var i = 0, len = arguments.length; i < len; ++i) {
//         process.stdout.write(arguments[i] + '\n');
//     }
// }
// list(1,2,3,4,5,6);
// exports.puts = util.deprecate(list, 'util.puts: Use console.log instead');
// this.puts();



util.format('%s:%s', 'foo');

util.format('%s:%s', 'foo', 'bar', 'baz'); // 'foo:bar baz'


var obj ={foo:'sdfsdfsfdsfds'};
console.log(util.format('%j', obj));





/////////////////////

// const util = require('util');


/*
class Box {
    constructor(value) {
        this.value = value;
    }

    inspect(depth, options) {
        if (depth < 0) {
            return options.stylize('[Box]', 'special');
        }

        const newOptions = Object.assign({}, options, {
            depth: options.depth === null ? null : options.depth - 1
        });

        // Five space padding because that's the size of "Box< ".
        const padding = ' '.repeat(5);
        const inner = util.inspect(this.value, newOptions).replace(/\n/g, '\n' + padding);
        return options.stylize('Box', 'special') + '< ' + inner + ' >';
    }
}

const box = new Box(true);

console.log(util.inspect(box));;

    */



// const EventEmitter = require('events');
// function MyStream() {
//     EventEmitter.call(this);
// }
// util.inherits(MyStream, EventEmitter);
// MyStream.prototype.write = function(data) {
//     this.emit('data', data);
// };
// const stream = new MyStream();
// console.log(stream instanceof EventEmitter); // true
// console.log(MyStream.super_ === EventEmitter); // true
// console.log(MyStream.super_);
// stream.on('data', (data) => {
//     console.log(`Received data: "${data}"`);
// });
// stream.write('It works!'); // Received data: "It works!"




// const EventEmitter = require('events');
// class MyStream extends EventEmitter {
//     constructor() {
//         super();
//     }
//     write(data) {
//         this.emit('data', data);
//     }
// }
// const stream = new MyStream();
// stream.on('data', (data) => {
//     console.log(`Received data: "${data}"`);
// });
// stream.write('With ES6');


console.log(require('events'));